class Eval implements RtlInsn {
    private Temp temp;
    private RtlExp exp;

    public Eval (Temp _temp, RtlExp _exp){
	temp =_temp;
	exp =_exp;
    }

    public Temp getTemp (){
	return temp;
    }

    public void setTemp (Temp _temp){
	temp =_temp;
    }

    public RtlExp getExp (){
	return exp;
    }

    public void setExp (RtlExp _exp){
	exp =_exp;
    }

    public String toString(){
	return "eval" + "(" + temp + " " + exp + ")";
    }


    public RtlInstrId getRtlId()
    {
	//Depends on the kind of expression.
	RtlExprId rei = exp.getRtlExprId();
	
	switch(rei)
	{
	case ADD :
	    return RtlInstrId.EVAL_ADD;
	case DIV :
	    return RtlInstrId.EVAL_DIV;
	case MUL :
	    return RtlInstrId.EVAL_MUL;
	case SUB :
	    return RtlInstrId.EVAL_SUB;
	case MOVE :
	    return RtlInstrId.EVAL_MOVE;
	case ICON :
	    return RtlInstrId.EVAL_ICON;	    
	case LABREF :
	    return RtlInstrId.EVAL_LABREF;	    
	case COMP_EQ :
	    return RtlInstrId.EVAL_EQ;	    
	case COMP_NE :
	    return RtlInstrId.EVAL_NE;	    
	case COMP_LT :
	    return RtlInstrId.EVAL_LT;	    
	case COMP_GT :
	    return RtlInstrId.EVAL_GT;	    
	case COMP_LTEQ :
	    return RtlInstrId.EVAL_LTEQ;	    
	case COMP_GTEQ :
	    return RtlInstrId.EVAL_GTEQ;	    
	default:
	    //TODO throw new NoSuchFieldException("invalid RtlExprId");	    
	    //Error management: later. (Should not happen this).
	    return null;
	}
    }

}
